package com.shd.edanpei.ui.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.shd.edanpei.R;
import com.shd.edanpei.base.BaseActivity;
import com.shd.edanpei.db.DaoManager;
import com.shd.edanpei.presenter.contract.PhoneResetContract;
import com.shd.edanpei.presenter.PhoneResetPresenter;

import butterknife.BindView;
import butterknife.OnClick;

public class PhoneResetActivity extends BaseActivity<PhoneResetPresenter>
        implements PhoneResetContract.PhoneResetIView {

    public static PhoneResetActivity instance;

    @BindView(R.id.headline)
    TextView headline;
    @BindView(R.id.et_chang_phone)
    EditText etPhone;
    @BindView(R.id.tv_phone_reset_hint)
    TextView tvHint;

    @Override
    protected int setLayout() {
        return R.layout.activity_reset_phone;
    }

    @Override
    protected PhoneResetPresenter bindPresenter() {
        return new PhoneResetPresenter(this);
    }

    @Override
    protected void initView(@Nullable Bundle savedInstanceState) {
        instance = this;
        headline.setText("更换手机号");
        tvHint.setText("更换手机号后，下次登录可使用新手机号登录。当前手机号为：" + DaoManager.getInstance().getUserBean().getMobile());
    }

    @Override
    protected void onRestart() {
        super.onRestart();
    }

    @Override
    protected void initListener() {

    }


    @OnClick({R.id.iv_headline_back, R.id.tv_phone_change})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.iv_headline_back:
                finish();
                break;
            case R.id.tv_phone_change:
                //下一步
                if (etData(etPhone)) {
                    mPresenter.getCode(etPhone.getText().toString());
                }
                break;
        }
    }


}
